import { nextTick } from 'vue'
import type { Router } from 'vue-router'

export function progressGuard(router: Router) {
  router.beforeEach(() => window.yulania.progress.start())
  router.afterEach(() => nextTick(window.yulania.progress.done))
}
